package com.by.orders.controller;


import com.by.common.core.bean.ResultBean;
import com.by.common.core.response.R;
import com.by.orders.entity.dto.OrderDto;
import com.by.orders.service.OrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Tag(name = "订单管理")
@RestController
@RequestMapping("/api/v1")
public class OrderController {

    @Autowired OrderService orderService;
    @PostMapping("/order/save")
    @Operation(summary = "保存订单")
    public ResultBean save(@RequestBody OrderDto orderDto){
        int rs=orderService.save(orderDto);
        return rs==1? R.success("保存成功"):R.fail("保存失败");
    }

}
